#include "Window.h"
#include<glad/glad.h>
#include<GLFW/glfw3.h>

namespace OCPP
{
	Window::Window(int width,int height)
		:mWindow(NULL),
		mWidth(width),
		mHeight(height)
	{
		mWindow = glfwCreateWindow(width, height, "YoutubeOpenGL", NULL, NULL);
		mViewport = new Viewport(0, 0, width, height);
		assert(mWindow);
	}

	Window::~Window()
	{
		glfwDestroyWindow(mWindow);
	}

	bool Window::shouldClose()
	{
		return glfwWindowShouldClose(mWindow);
	}

	void Window::createViewport(int x, int y, int width, int height)
	{
		mViewport = new Viewport(x, y, width, height);
	}

	void Window::makeViewport()
	{
		mViewport->make();
	}

	void Window::makeContextCurrent()
	{
		glfwMakeContextCurrent(mWindow);
	}


}